﻿<style type="text/css">
    .mv-list-image{margin-top: 5px;overflow: hidden;}
    .list-left img{display: inline-block;height: 40px;}
</style>
<div class="mv-tabs">
    <a class="mid-color" v-on:click="choose($event,-1)">所有</a><a v-on:click="choose($event,1)">转入</a><a v-on:click="choose($event,2)">转出</a>
</div>
<div class="mv-list-image">
    <ul>
        <li v-for="data in bag.datas">
            <a v-on:click="detail(data.id,data.title)">
                <div class="list-content">
                    <div class="list-left">
                        <img :src="'/Images/Icons/stock_deal_'+data.type+'.png'" />
                    </div>
                    <div class="list-right">
                        <div class="right-a">
                            <h2 v-text="data.title">-</h2>
                            <p class="price-plus" v-text="'['+data.accounttype+'-'+data.typename+']'">-</p>
                            <p class="list-time" v-text="data.addtime">-</p>
                        </div>
                        <div class="right-b price-plus" v-text="data.money"></div>
                    </div>
                </div>
            </a>
        </li>
    </ul>
</div>
<div style="text-align:center;margin-top:0.5em;" v-if="bag.dataend == false">
    <a v-on:click="more" v-text="morename" style="color:#888;">-</a>
</div>
<div style="text-align:center;margin-top:0.5em;" v-if="bag.dataend == true">
    <a style="color:#aaa;">已显示所有</a>
</div>
<div style="height:60px;"></div>
<script type="text/javascript">
    var pagedata = {
        request: {
            method: "VIEW_STOCK_DEALLISTS",
            page: 0,
            type: -1
        },
        screen: {
            header_display: true,
            header_title_name: "账单",
            header_exit_name: "返回",
            header_exit_click: function ()
            {
                mview.view.load('/views/home/main.html')
            },
            footer_display: true,
            footer_choose: "user"
        },
        data: {
            morename: "查看更多"
        },
        methods: {
            choose: function (elm, type) {
                m.view.node(".mv-tabs a").removeClass("mid-color");
                m.view.node(elm.currentTarget).addClass("mid-color");
                pagedata.request.page = 0;
                pagedata.request.type = type;
                pagedata.reload();
            },
            detail: function (id, title) {
                mview.view.load('/views/Stock/dealdetail.html', {
                    id: id,
                    title: title
                });
            },
            //加载更多
            more: function () {
                pagedata.request.page += 1;
                mview.socket.send({
                    data: {
                        method: "VIEW_STOCK_DEALLISTS",
                        page: pagedata.request.page,
                        type: pagedata.request.type,
                        part: 1
                    },
                    success: function (json) {
                        if (json.Code == 0 && json.Data.datas.length > 0) {
                            for (var i in json.Data.datas) {
                                var data = json.Data.datas[i];
                                mview.vue.stage.$data.bag.dataend = json.Data.dataend;
                                mview.vue.stage.$data.bag.datas.push(data);
                            }
                        }
                    }
                });
            }
        }
    }
    mview.view.chlid.init(pagedata);
</script>